Skip to content

Conversation

@tobiascadee
Copy link
Collaborator

finance: add structured debug logging and harden Mollie payment flow

Instrument CreateTransactionView, ConfirmTransactionView, and PaymentWebHook with structured logs:
Short, consistent event messages; detailed context in extra (order_id, user_id, mollie_id, status, checkout_url, remote IP, is_paid)
Logs cover initiation, redirect, confirm/return, webhook, and error paths
Wrap Mollie API calls in try/except and log failures with context
On initiation failure: unfreeze order (finalized=False), show user-friendly error, and redirect to retry
Ensure mollie_id extraction works with dict-like and attribute results (supports tests’ FakePaymentResult)
Return 404 for webhook calls missing id (aligns with existing tests)
Keep EventLog.event <= 255 chars; move long details (URLs, exceptions) to extra
Preserve success-path behavior; no functional changes to payment completion logic
Testing:

Ran test suite; finance-related tests pass after adjustments
One unrelated ordering time-bound test fails (quarter-end edge), not impacted by these changes
Notes:

Expect increased EventLog volume; consider adding admin filters or retention as needed
These logs should make it clear where “paid but not completed” flows stall (initiation vs return vs webhook) and with which Mollie status/ids

@bveldkamp bveldkamp merged commit 2e3103f into main Oct 11, 2025
6 checks passed
@bveldkamp bveldkamp deleted the tobias/add-logging-to-payment-logic branch October 11, 2025 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants